import Vue from "vue";
import $router from '../router/index.js'
import { sendGet, sendPost } from "./request.js";

//菜单管理：
//查询所有菜单数据(包含子菜单):
export let getMenuAll = () => sendGet('/api/menulist', { istree: true });
//添加
export let addMenu = d => sendPost('/api/menuadd', d)
//查询某一个
export let getOneMenu = d => sendGet('/api/menuinfo', d)
//修改
export let updateOneMenu = d => sendPost('/api/menuedit', d)
//删除
export let menuDelete = d => sendPost('/api/menudelete', d)
//菜单管理结束：



//角色管理
//列表
export let roleList = d => sendGet('/api/rolelist', d)
//添加
export let roleAdd = d => sendPost('api/roleadd', d)
//删除
export let roleDelete = d => sendPost('/api/roledelete', d)
//获取一个信息
export let roleInfo = d => sendGet('/api/roleinfo', d)
//修改
export let roleEdit = d => sendPost('/api/roleedit', d)
//角色管理结束



//管理员管理
//总数
export let userCount = () => sendGet('/api/usercount')
//列表
export let userList = d => sendGet('/api/userlist', d)
//添加
export let addManUser = d => sendPost('/api/useradd', d)
//获取（一条数据）
export let userInfo = d => sendGet('/api/userinfo', d)
//修改
export let userEdit = d => sendPost('/api/useredit', d)
//删除
export let userDelete = d => sendPost('/api/userdelete', d)
//登录
export let userlogin = d => sendPost('/api/userlogin',d)
//管理员管理结束


//商品管理
//商品分类信息
export let getCates = () => sendGet('/api/getcates')
//分类列表
export let cateList = () => sendGet('/api/catelist', { istree: true })
//上传
export let cateAdd = (d, isfile = false) => sendPost('/api/cateadd', d, isfile);
//获取一个信息
export let cateInfo = d => sendGet('/api/cateinfo', d)
//修改
export let cateEdit = (d, isfile = false) => sendPost('/api/cateedit', d, isfile)
//删除
export let cateDelete = d => sendPost('/api/catedelete', d)
//商品管理结束



//商品规格
//列表
export let specsList = d => sendGet('/api/specslist', d)
//总数
export let specsCount = () => sendGet('/api/specscount')
//添加
export let specsadd = d => sendPost('/api/specsadd', d)
//修改
export let specsedit = d => sendPost('/api/specsedit', d)
//获取（一条）
export let specsinfo = d => sendGet('/api/specsinfo', d)
//删除
export let specsdelete = d => sendPost('/api/specsdelete', d)
//商品规格结束


//商品管理
//列表
export let goodslist = d => sendGet('/api/goodslist',d)
//商品总数
export let goodscount = () => sendGet('/api/goodscount') 
//规格
export let goodsSpecs = () => sendGet('/api/specslist')
//添加
export let goodsadd = (d,isfile=false) => sendPost('/api/goodsadd',d,isfile)
//获取一条信息
export let goodsinfo = d => sendGet('/api/goodsinfo',d)
//修改
export let goodsedit = (d,isfile=false) => sendPost('/api/goodsedit',d,isfile)
//删除
export let goodsdelete = d => sendPost('/api/goodsdelete',d)
//商品管理结束


//会员管理
//列表
 export let memberlist = () => sendGet('/api/memberlist')
//获取一条
export let memberinfo = d => sendGet('/api/memberinfo',d)
//修改
export let memberedit = d => sendPost('/api/memberedit',d)
//会员管理结束


//轮播图管理
//列表
export let bannerlist = () => sendGet('/api/bannerlist')
//添加
export let banneradd = (d,isfile=false) => sendPost('/api/banneradd',d,isfile)
//获取一条
export let bannerinfo = (d) => sendGet('/api/bannerinfo',d)
//修改
export let banneredit = (d,isfile=false) => sendPost('/api/banneredit',d,isfile)
//删除
export let bannerdelete = d => sendPost('/api/bannerdelete',d)
//轮播图管理结束



//秒杀管理
//列表
export let secklist = () => sendGet('/api/secklist')
//一条
export let seckinfo = d => sendGet('/api/seckinfo',d)
//修改
export let seckedit = d => sendPost('/api/seckedit',d)
//删除
export let seckdelete = d => sendPost('/api/seckdelete',d)
//添加
export let seckadd = d => sendPost('/api/seckadd',d)
//获取分类

//秒杀管理结束